package com.alibaba.otter.node.etl.load.loader.mq.rabbit.callback;

import com.alibaba.otter.node.etl.load.loader.mq.rabbit.exception.MqPluginException;
import lombok.extern.slf4j.Slf4j;

@Slf4j
public class DefaultConsumeFailureCallback implements ConsumeFailureCallback {

    @Override
    public void onDeserializeFailure(Object message, Throwable e) {
        throw new MqPluginException("消息反序列化失败", e);
    }

    @Override
    public void onNoDestination(String queue) {
        String msg = "queue[" + queue + "]不存在";
        log.error(msg);
        throw new MqPluginException(msg);
    }

    @Override
    public void onBizFailure(Object message, Throwable e) {
        throw new MqPluginException("业务代码发生异常", e);
    }

    @Override
    public void onUnexpectedError(Throwable cause) {
        throw new MqPluginException("消息处理失败", cause);
    }
}
